<template>
	<div v-bind:class="msg_class" v-on:click="send_msg">
        {{ content }}  
    </div>
</template>
<script>
	export default{
		name: 'countdown',
        computed: {

        },
        data: function(){
            return{
                content: '发送验证',
                msg_class: 'fasyaz',
                time: 60,
            }
        },
        mounted: function(){
            this.init()
        },
        methods: {
            init: function(){
                this.$emit('init')
            },
            send_msg: function(){
                var itv = setInterval(function(){
                    this.content = this.time
                    if (time <= 0)
                    {
                        clearInterval(itv)
                        this.content = '发送验证'
                    }
                    this.time--
                }, 1000)
            },
            
        }
	}
</script>
<style>
	
</style>